<!DOCTYPE html>

<html lang="en">

    <head>
        <meta charset="UTF-8">
        <title>Title</title>

        <script type="text/javascript">
            function async( url ){
                let executor = function( resolve , reject ){
                    let $http = new XMLHttpRequest();
                    $http.responseType = 'json' ;
                    $http.addEventListener( 'load' , function(){
                        if( this.status == 200 ) {
                            resolve( this.response );
                        } else {
                            reject( this.statusText );
                        }
                    });
                    $http.open( 'GET' , url );
                    $http.send();
                }

                let promise = new Promise( executor );

                let wrapper = document.querySelector( '.wrapper' );

                let onResolved = function( data ){
                    console.log( data );
                    wrapper.innerHTML = data ;
                }

                let onRejected = function ( text ) {
                    wrapper.innerHTML = text ;
                }

                promise.then( onResolved , onRejected );
            }
        </script>

    </head>
    <body>

        <div class="wrapper"></div>

        <script type="text/javascript">
            // async( '/wu/yan/ta/ba/zu' );
            async( 'package.json' );
        </script>

    </body>
</html>